#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ(2.61)
AC_INIT([lunar-applet],[1.8],[yetist@gmail.com])
AM_INIT_AUTOMAKE(lunar-applet, 1.8)
AC_CONFIG_SRCDIR([src/lunar.c])
AC_CONFIG_HEADERS([config.h])
AC_PREFIX_DEFAULT([/usr])

AC_CONFIG_MACRO_DIR([m4])
GNOME_COMMON_INIT

AM_MAINTAINER_MODE
GNOME_MAINTAINER_MODE_DEFINES

IT_PROG_INTLTOOL([0.35.0])

GNOME_DOC_INIT
AC_PROG_LIBTOOL
GTK_DOC_CHECK([1.0])

AC_PROG_CXX
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_CC
AC_PROG_RANLIB
AC_LIBTOOL_SETUP
AC_PROG_RANLIB
AC_ISC_POSIX
AC_HEADER_STDC

################################3333
GNOME_COMPILE_WARNINGS(yes)

GCONF_SCHEMAS_INSTALL
AC_PATH_PROG(GCONFTOOL, gconftool-2)

AC_ARG_ENABLE(deprecations,
              [AS_HELP_STRING([--enable-deprecations],[warn about deprecated usages [default=no]])],,
              [enable_deprecations=no])

if test "x$enable_deprecations" = "xyes"; then
   DISABLE_DEPRECATED_CFLAGS=$DISABLE_DEPRECATED
   AC_SUBST(DISABLE_DEPRECATED_CFLAGS)
fi

AC_ARG_ENABLE(process,
              [AS_HELP_STRING([--enable-process],[compile in-process [default=no]])],,
              [enable_process=yes])

if test "x$enable_process" = "xyes"; then
   CLOCK_COMPILE_INPROCESS=$DISABLE_PROCESS
   AC_SUBST(CLOCK_INPROCESS)
fi
AM_CONDITIONAL(CLOCK_INPROCESS, test -n "$CLOCK_COMPILE_INPROCESS")

# Checks for libraries.
GTK_REQUIRED=2.8.20
LIBGNOMEUI_REQUIRED=2.5.4
LIBECAL_REQUIRED=1.6.0
LIBEDATASERVERUI_REQUIRED=1.2.0
LIBPANELAPPLET_REQUIRED=2.14.3

PKG_CHECK_MODULES(LIBPANEL_APPLET, libpanelapplet-2.0 >= $LIBPANELAPPLET_REQUIRED,
                  [],
                  [AC_MSG_ERROR([libpanelapplet-2.0 not found. 

on Debian or Ubuntu, install this please:
    # apt-get install libpanel-applet2-dev
                   ])])
AC_SUBST(LIBPANEL_APPLET_CFLAGS)
AC_SUBST(LIBPANEL_APPLET_LIBS)

AC_ARG_ENABLE(eds,
        AS_HELP_STRING([--enable-eds],[Enable evolution-data-server dependencies @<:@default=auto@:>@
        ]),,enable_eds=auto)
LIBECAL_REQUIREMENT=
if test "x$enable_eds" = "xyes"; then
  LIBECAL_REQUIREMENT="libecal-1.2 >= $LIBECAL_REQUIRED libedataserverui-1.2 >= $LIBEDATASERVERUI_REQUIRED"
else
  if test "x$enable_eds" != "xno"; then
    AC_MSG_CHECKING(for evolution-data-server)
    if $PKG_CONFIG --exists libecal-1.2 libedataserverui-1.2; then
       AC_MSG_RESULT(yes)
       LIBECAL_REQUIREMENT="libecal-1.2 >= $LIBECAL_REQUIRED libedataserverui-1.2 >= $LIBEDATASERVERUI_REQUIRED"
    else
       AC_MSG_RESULT(no)
    fi
  fi
fi
if test -n "$LIBECAL_REQUIREMENT"; then
  AC_DEFINE([HAVE_LIBECAL], 1,
            [Defined when evolution-data-server libecal-1.2 and libedataserverui-1.2 are detected])
fi

AM_CONDITIONAL(HAVE_LIBECAL, test -n "$LIBECAL_REQUIREMENT")

PKG_CHECK_MODULES(LUNAR, gtk+-2.0 >= $GTK_REQUIRED libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED $LIBECAL_REQUIREMENT)
AC_SUBST(LUNAR_CFLAGS)
AC_SUBST(LUNAR_LIBS)



# Checks for header files.
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_HEADER_STDC
AC_CHECK_HEADERS([langinfo.h libintl.h stdlib.h string.h sys/time.h unistd.h])

# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_TYPE_SSIZE_T
AC_STRUCT_TM

# Checks for library functions.
AC_FUNC_MALLOC
AC_FUNC_MKTIME
AC_FUNC_STRFTIME
AC_CHECK_FUNCS([memset nl_langinfo])


dnl  Language Support 
ALL_LINGUAS="zh_CN"
GETTEXT_PACKAGE=lunar-applet
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Define the gettext package to be used])
AC_SUBST(GETTEXT_PACKAGE)

AM_GLIB_GNU_GETTEXT

AM_GCONF_SOURCE_2

AC_CONFIG_FILES([ 
           lunar-applet.spec
           Makefile 
           icons/Makefile
           icons/16x16/Makefile
           icons/22x22/Makefile
           icons/24x24/Makefile
           icons/32x32/Makefile
           po/Makefile.in 
           gtkchinesecalendar/Makefile
           test/Makefile
           src/Makefile
           docs/Makefile
           docs/reference/Makefile
           ])
AC_OUTPUT

